#include <algorithm>
#include <iostream>
using namespace std;

const int kMaxN = 12;
int n, sum;
int now[kMaxN], coefficient[kMaxN + 1];
int log_table[1 << kMaxN];
int opt[kMaxN + 1][kMaxN + 1];
bool need_return = false;

void Pre(int n) {
  sum -= 1 << (n - 1);
  coefficient[0] = 1;
  for (int i = 0; i < n; i++) {
    log_table[1 << i] = i;
    coefficient[i + 1] = coefficient[i] * (n - i - 1) / (i + 1);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      opt[i + 1][j] = opt[i][j];
    }
    opt[i + 1][i] = coefficient[i];
    sort(opt[i + 1], opt[i + 1] + i + 1);
  }
}

bool InRange(int state, int now_sum, int rest_len) {
  int min_sum = 0, max_sum = 0;
  int i = 0;

  for (; state; state -= state & (-state), i++) {
    int id = log_table[state & (-state)];

    min_sum += id * opt[rest_len][rest_len - i - 1];
    max_sum += id * opt[rest_len][i];
  }
  return min_sum + now_sum <= sum && sum <= now_sum + max_sum;
}

void DFS(int state, int now_sum, int dep) {
  if (!InRange(state, now_sum, n - dep) || need_return)
    return;
  if (dep == n) {
    need_return = true;
    for (int i = 0; i < n; i++) {
      cout << now[i] + 1 << ' ';
    }
    cout << endl;
    return;
  }
  for (int x = state; x; x -= x & (-x)) {
    int id = log_table[x & (-x)];

    now[dep] = id;
    DFS(state - (x & (-x)), now_sum + id * coefficient[dep], dep + 1);
  }
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

  cin >> n >> sum;

  Pre(n);
  DFS((1 << n) - 1, 0, 0);
  return 0;
}